package com.deadline.statebutton;

import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.components.element.Element;
import ohos.agp.render.Canvas;
import ohos.agp.render.Paint;
import ohos.agp.utils.Color;
import ohos.app.Context;

public class ViewExtend extends Component implements Component.DrawTask {

    private Paint mPaint;

    private ViewExtend(Context context) {
        super(context);
    }

    private ViewExtend(Context context, AttrSet attrSet) {
        super(context, attrSet);
        init();
        invalidate();
    }

    private ViewExtend(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
    }

    private ViewExtend(Context context, AttrSet attrSet, int resId) {
        super(context, attrSet, resId);
    }

    private void init() {
        mPaint = new Paint();
        mPaint.setColor(Color.RED);
        mPaint.setStyle(Paint.Style.STROKE_STYLE);
        mPaint.setStrokeWidth(10);
    }

    @Override
    public void invalidate() {
        super.invalidate();
        addDrawTask(this::onDraw);
    }

    @Override
    public void onDraw(Component component, Canvas canvas) {

    }
}
